# import time
# from threads.BaseWorker import BaseWorker
# from PyQt5.QtCore import pyqtSlot
# import ctypes
#
# class ClickWorker(BaseWorker):
#     """
#     BaseWorker 实现
#     """
#     def __init__(self, param1, param2):
#         super().__init__()
#         self.param1 = param1
#         self.param2 = param2
#         self._is_running = True
#
#     @pyqtSlot()
#     def run(self):
#
#         try:
#             for i in range(1, 101):
#                 if not self._is_running:
#                     self.message.emit("任务被中止")
#                     break
#
#                 click_num = 0
#                 # 模拟工作
#                 time.sleep(60)
#                 ctypes.windll.user32.SetCursorPos(self.param1, self.param2)
#                 click_num += 1
#                 print('已点击%s次', click_num)
#
#                 self.progress.emit(click_num)
#                 self.message.emit(f"处理中: {result}")
#         except Exception as e:
#             self.error.emit(f"发生错误: {str(e)}")
#         finally:
#             self.finished.emit()
#
#     def stop(self):
#         self._is_running = False